package com.example.photoview;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Model {//规范字节和时间格式
    public static double KB=1024.0;
    public static double MB=1024.0*1024.0;
    public static double GB=1024.0*1024.0*1024.0;
    public static String getFormLength(long filelength){
  String standard;
  if(filelength<KB){
      standard=String.format("%d Byte",filelength);}
      else if(filelength<MB){
          standard=String.format("%.0f KB",filelength/KB);
      }
  else if(filelength<GB){
      standard=String.format("%.0f MB",filelength/MB);
  }
  else{
      standard=String.format("%.0f GB",filelength/GB);
  }
return standard;

    }
    public static String getFormDate(long fileDate){
        Date date=new Date(fileDate);
        SimpleDateFormat slf=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        return slf.format(date);
    }
}
